<template>
    <div>
        <van-nav-bar title="修改地址" left-arrow @click-left="$router.push('/user')" />
        <van-address-edit
            :area-list="areaList"
            show-delete
            show-set-default
            show-search-result
            :search-result="searchResult"
            :area-columns-placeholder="['请选择', '请选择', '请选择']"
            @save="onSave"
            @delete="onDelete"
            @change-detail="onChangeDetail"
        />
    </div>
</template>

<script>
import areaList from "../../plugins/areaList.js"
import {UPDATE_FOOTER} from "../../store/types"
import store from "../../plugins/vuex"
export default {
    name: "",
    data() {
        return {
            areaList,
            searchResult: []
        };
    },
    props: {},
    methods: {
        onSave() {
            Toast("save");
        },
        onDelete() {
            Toast("delete");
        },
        onChangeDetail(val) {
            if (val) {
                this.searchResult = [
                    {
                        name: "黄龙万科中心",
                        address: "杭州市西湖区"
                    }
                ];
            } else {
                this.searchResult = [];
            }
        }
    },
    beforeRouteEnter(to, from, next) { 
        store.commit(UPDATE_FOOTER, false)
        next()
    }
};
</script>

<style scoped>
</style>
